package cn.gson.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.List;


/**
 * The persistent class for the PRODUCT database table.
 * 
 */

@Entity
@NamedQuery(name="Product.findAll", query="SELECT p FROM Product p")
public class Product implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(initialValue=1,allocationSize=1,name="PRODUCT_PRODUCTID_GENERATOR", sequenceName="SEQ_36")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="PRODUCT_PRODUCTID_GENERATOR")
	@Column(name="PRODUCT_ID")
	private long productId;//主键id

	@Column(name="PRO_INFO_COST")
	private BigDecimal proInfoCost;//成本

	@Column(name="PRO_INFO_STA")
	private String proInfoSta;//型号

	@Column(name="PRO_PRICE")
	private BigDecimal proPrice;//价格

	@Column(name="PRO_STA")
	private BigDecimal proSta;//状态，0为正常，1为售停

	@Column(name="PRODUCT_NAME")
	private String productName;//产品名称

	@Column(name="UNIT_ID")
	private String unitId;//产品单位




	//bi-directional many-to-one association to Orderdetails1
	@OneToMany(mappedBy="product")
	private List<Orderdetails1> orderdetails1s;

	//bi-directional many-to-one association to ClassifyProductTb
	@ManyToOne
	@JoinColumn(name="CLASSIFY_ID")
	private ClassifyProductTb classifyProductTb;//分类表

	//bi-directional many-to-one association to InveTb
	@ManyToOne
	@JoinColumn(name="INVE_ID")
	private InveTb inveTb;

	//bi-directional many-to-one association to Orderdetails1
	@ManyToOne
	@JoinColumn(name="OD_ID")
	private Orderdetails1 orderdetails1;

	public Product() {
	}

	public Product(long productId, BigDecimal proInfoCost, BigDecimal proPrice) {
		super();
		this.productId = productId;
		this.proInfoCost = proInfoCost;
		this.proPrice = proPrice;
	}

	public long getProductId() {
		return this.productId;
	}

	public void setProductId(long productId) {
		this.productId = productId;
	}

	public BigDecimal getProInfoCost() {
		return this.proInfoCost;
	}

	public void setProInfoCost(BigDecimal proInfoCost) {
		this.proInfoCost = proInfoCost;
	}

	public String getProInfoSta() {
		return this.proInfoSta;
	}

	public void setProInfoSta(String proInfoSta) {
		this.proInfoSta = proInfoSta;
	}

	public BigDecimal getProPrice() {
		return this.proPrice;
	}

	public void setProPrice(BigDecimal proPrice) {
		this.proPrice = proPrice;
	}

	public BigDecimal getProSta() {
		return this.proSta;
	}

	public void setProSta(BigDecimal proSta) {
		this.proSta = proSta;
	}

	public String getProductName() {
		return this.productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public String getUnitId() {
		return this.unitId;
	}

	public void setUnitId(String unitId) {
		this.unitId = unitId;
	}





	public List<Orderdetails1> getOrderdetails1s() {
		return this.orderdetails1s;
	}

	public void setOrderdetails1s(List<Orderdetails1> orderdetails1s) {
		this.orderdetails1s = orderdetails1s;
	}

	public Orderdetails1 addOrderdetails1(Orderdetails1 orderdetails1) {
		getOrderdetails1s().add(orderdetails1);
		orderdetails1.setProduct(this);

		return orderdetails1;
	}

	public Orderdetails1 removeOrderdetails1(Orderdetails1 orderdetails1) {
		getOrderdetails1s().remove(orderdetails1);
		orderdetails1.setProduct(null);

		return orderdetails1;
	}

	public ClassifyProductTb getClassifyProductTb() {
		return this.classifyProductTb;
	}

	public void setClassifyProductTb(ClassifyProductTb classifyProductTb) {
		this.classifyProductTb = classifyProductTb;
	}

	public InveTb getInveTb() {
		return this.inveTb;
	}

	public void setInveTb(InveTb inveTb) {
		this.inveTb = inveTb;
	}

	public Orderdetails1 getOrderdetails1() {
		return this.orderdetails1;
	}

	public void setOrderdetails1(Orderdetails1 orderdetails1) {
		this.orderdetails1 = orderdetails1;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Product [productId=" + productId + ", proInfoCost=" + proInfoCost + ", proInfoSta=" + proInfoSta
				+ ", proPrice=" + proPrice + ", proSta=" + proSta + ", productName=" + productName + ", unitId="
				+ unitId + ", classifyProductTb=" + classifyProductTb + ", inveTb=" + inveTb + "]";
	}

}